翻訳と辞書
Words near each other
・ "O" Is for Outlaw
・ "O"-Jung.Ban.Hap.
・ "Ode-to-Napoleon" hexachord
・ "Oh Yeah!" Live
・ "Our Contemporary" regional art exhibition (Leningrad, 1975)
・ "P" Is for Peril
・ "Pimpernel" Smith
・ "Polish death camp" controversy
・ "Pro knigi" ("About books")
・ "Prosopa" Greek Television Awards
・ "Pussy Cats" Starring the Walkmen
・ "Q" Is for Quarry
・ "R" Is for Ricochet
・ "R" The King (2016 film)
・ "Rags" Ragland
・ ! (album)
・ ! (disambiguation)
・ !!
・ !!!
・ !!! (album)
・ !!Destroy-Oh-Boy!!
・ !Action Pact!
・ !Arriba! La Pachanga
・ !Hero
・ !Hero (album)
・ !Kung language
・ !Oka Tokat
・ !PAUS3
・ !T.O.O.H.!
・ !Women Art Revolution


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

value object : ウィキペディア英語版
value object
In computer science, a value object is a small object that represents a ''simple'' entity whose equality is not based on identity: i.e. two value objects are ''equal'' when they ''have'' the same ''value'', not necessarily being the ''same object''.
Examples of value objects are objects representing an amount of money or a date range.
Being small, one can have multiple copies of the same value object that represent the same ''entity'': it is often simpler to create a new object rather than rely on a single instance and use references to it.〔
Value objects should be immutable: this is required for the implicit contract that two value objects created ''equal'', should remain equal. It is also useful for value objects to be immutable, as client code cannot put the value object in an invalid state or introduce buggy behaviour after instantiation.
Value objects work better if they have native support for ''copy-by-value semantics'', i.e. the expression
valueObject1 = valueObject2
assigns the ''value'' of the valueObject1 by creating a copy of the valueObject2, instead of assigning a reference to the second object, as happens in most object oriented languages for assignments among objects.
Value objects are among the building blocks of DDD.
==Value objects in C#==
In C# a class is a reference type while a struct (concept derived from the struct in C language) is a value type.
Hence an instance derived from a class definition is an object while an instance derived from a struct definition is said to be a value object (to be precise a struct can made immutable to represent a value object declaring attributes as readonly).
The main differences between objects and value objects in C# are that:
* objects are mutable
* value objects are immutable
* objects are referenced and the expression object1 = object2 assigns to object1 a reference to object2
* value objects are copied by value (cloned): hence the expression valueObject1 = valueObject2 makes a copy of the values of the attributes of valueObject2 to those of valueObject1.
The memory management is also different: the data of a struct in C# is kept in the stack while for classes the data is stored in the heap memory.
This memory management can help in terms of performance. This does not happen when the value in question is wrapped inside another object, e.g. an array of some struct type, in which case the struct(s) will live, inside the object, on the heap.〔"〕

抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「value object」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.